package com.xinqi.common.third.oss;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * OSS配置信息
 *
 * @author linkai
 * @date 2023/2/18
 */
@Data
@ConfigurationProperties(prefix = "third.oss")
public class OssProperties {

    /**
     * 类型
     */
    private OssType type;

    /**
     * url前缀
     */
    private String prefix;

    private QiNiu qiNiu;

    private AliYun aliYun;

    private QCloud qCloud;

    private Minio minio;

    @Data
    public static class QiNiu {

        @NotBlank(message = "七牛绑定的域名不能为空")
        private String domain;

        private String prefix;

        @NotBlank(message = "七牛AccessKey不能为空")
        private String accessKey;

        @NotBlank(message = "七牛SecretKey不能为空")
        private String secretKey;

        @NotBlank(message = "七牛空间名不能为空")
        private String bucketName;

    }

    @Data
    public static class AliYun {

        // 阿里云绑定的域名
        @NotBlank(message = "阿里云绑定的域名不能为空")
        private String domain;

        // 阿里云路径前缀
        private String prefix;

        // 阿里云EndPoint
        @NotBlank(message = "阿里云EndPoint不能为空")
        private String endpoint;

        // 阿里云AccessKeyId
        @NotBlank(message = "阿里云AccessKeyId不能为空")
        private String accessKeyId;

        // 阿里云AccessKeySecret
        @NotBlank(message = "阿里云AccessKeySecret不能为空")
        private String accessKeySecret;

        // 阿里云BucketName
        @NotBlank(message = "阿里云BucketName不能为空")
        private String bucketName;

    }

    @Data
    public static class QCloud {

        // 腾讯云绑定的域名
        @NotBlank(message = "腾讯云绑定的域名不能为空")
        private String domain;

        // 腾讯云路径前缀
        private String prefix;

        // 腾讯云AppId
        @NotNull(message = "腾讯云AppId不能为空")
        private Integer appId;

        // 腾讯云SecretId
        @NotBlank(message = "腾讯云SecretId不能为空")
        private String secretId;

        // 腾讯云SecretKey
        @NotBlank(message = "腾讯云SecretKey不能为空")
        private String secretKey;

        // 腾讯云BucketName
        @NotBlank(message = "腾讯云BucketName不能为空")
        private String bucketName;

        // 腾讯云COS所属地区
        @NotBlank(message = "所属地区不能为空")
        private String region;

    }

    @Data
    public static class Minio {

        @NotBlank(message = "Minio的不能为空")
        private String endpoint;

        @NotBlank(message = "Minio的accessKey不能为空")
        private String accessKey;

        @NotBlank(message = "Minio的secretKey不能为空")
        private String secretKey;

        @NotBlank(message = "Minio的BucketName不能为空")
        private String bucketName;

    }

}
